package com.mida.dms.knw.controller;

import com.mida.dms.knw.entity.KnwConceptualDetail;
import com.mida.dms.knw.entity.vo.KnwConceptualDetailVo;
import com.mida.dms.knw.service.KnwConceptualDetailService;
import com.mida.dms.knw.vo.KnwConceptualDetailPageVo;
import com.mida.dms.knw.vo.PageResultVo;
import com.mida.tool.common.result.ActionResult;
import com.mida.tool.common.result.ListResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 概念描述接口
 *
 * @author conyfrommars
 */
@RestController
@RequestMapping("/knwConceptualDetail")
@Api(tags = "概念描述接口")
@CrossOrigin
public class KnwConceptualDetailController implements BaseControl<KnwConceptualDetail, KnwConceptualDetailPageVo> {

    @Autowired
    KnwConceptualDetailService knwConceptualDetailService;


    /**
     * 1、新增概念描述
     */
    @ApiOperation(value = "新增概念描述", notes = "新增概念描述")
    @PostMapping(value = "/addKnwConceptualDetail", produces = {"application/json;charset=UTF-8"})
    @ResponseBody
    @Override
    public ActionResult add(KnwConceptualDetail t) {
        return knwConceptualDetailService.add(t);
    }

    /**
     * 2、更新概念描述
     */
    @ApiOperation(value = "更新概念描述", notes = "更新概念描述")
    @PostMapping(value = "/updateKnwConceptualDetail", produces = {"application/json;charset=UTF-8"})
    @ResponseBody
    @Override
    public ActionResult update(KnwConceptualDetail t) {
        return knwConceptualDetailService.update(t);
    }

    /**
     * 3、删除概念描述
     */
    @ApiOperation(value = "删除概念描述", notes = "删除概念描述")
    @ApiImplicitParam(name = "soid", value = "概念描述soid", required = false)
    @GetMapping(value = "/deleteKnwConceptualDetail")
    @ResponseBody
    @Override
    public ActionResult delete(long soid) {
        return knwConceptualDetailService.delete(soid);
    }

    /**
     * 4、 获取概念描述
     */
    @ApiOperation(value = "获取概念描述", notes = "获取概念描述")
    @ApiImplicitParam(name = "soid", value = "概念描述soid", required = false)
    @GetMapping(value = "/getKnwConceptualDetail")
    @ResponseBody
    @Override
    public ListResult<KnwConceptualDetail> get(long soid) {
        return knwConceptualDetailService.get(soid);
    }

    /**
     * 5、分页查询概念描述
     */
    @ApiOperation(value = "分页查询概念描述", notes = "分页查询概念描述")
    @PostMapping(value = "/findPage", produces = {"application/json;charset=UTF-8"})
    @ResponseBody
    @Override
    public ListResult<PageResultVo<KnwConceptualDetailVo>> findPage(KnwConceptualDetailPageVo vo) {
        return knwConceptualDetailService.findPage(vo);
    }

    /**
     * 6、检查名称
     */
    @ApiOperation(value = "检查名称", notes = "检查名称")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "soid", value = "概念描述soid", required = false),
            @ApiImplicitParam(name = "name", value = "概念描述名称", required = false)
    })
    @GetMapping(value = "/checkName")
    @ResponseBody
    public ActionResult checkName(Long soid, String name) {
        return knwConceptualDetailService.checkName(soid, name);
    }

    /**
     * 7、设置概念描述首选
     */
    @ApiOperation(value = "设置概念描述首选", notes = "设置概念描述首选")
    @ApiImplicitParam(name = "soid", value = "概念描述soid", required = false)
    @GetMapping(value = "/setFirst")
    @ResponseBody
    public ActionResult setFirst(Long soid, Long conceptualSoid, Long isConceptualDomain) {
        return knwConceptualDetailService.setFirst(soid, conceptualSoid, isConceptualDomain);
    }
}
